home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / xpuzzles.3 / xpuzzles / xpuzzles-5.3.1 / xhexagons / HexagonsP.h < prev    next >
C/C++ Source or Header  |  1996-02-05  |  3KB  |  133 lines

  1. /*
  2. # X-BASED HEXAGONS
  3. #
  4. #  HexagonP.h
  5. #
  6. ###
  7. #
  8. #  Copyright (c) 1994 - 96    David Albert Bagley, bagleyd@hertz.njit.edu
  9. #
  10. #                   All Rights Reserved
  11. #
  12. #  Permission to use, copy, modify, and distribute this software and
  13. #  its documentation for any purpose and without fee is hereby granted,
  14. #  provided that the above copyright notice appear in all copies and
  15. #  that both that copyright notice and this permission notice appear in
  16. #  supporting documentation, and that the name of the author not be
  17. #  used in advertising or publicity pertaining to distribution of the
  18. #  software without specific, written prior permission.
  19. #
  20. #  This program is distributed in the hope that it will be "playable",
  21. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23. #
  24. */
  25.  
  26. /* Private header file for Hexagons */
  27.  
  28. #ifndef _HexagonsP_h
  29. #define _HexagonsP_h
  30.  
  31. #include "Hexagons.h"
  32.  
  33. /*** random number generator ***/
  34. /* insert your favorite */
  35. extern void SetRNG();
  36. extern long LongRNG();
  37. #define SRAND(X) SetRNG((long) X)
  38. #define LRAND() LongRNG()
  39.  
  40. #define NRAND(X) ((int)(LRAND()%(X)))
  41.  
  42. #define SYMBOL ':'
  43.  
  44. #define TR 0
  45. #define RIGHT 1
  46. #define BR 2
  47. #define BL 3
  48. #define LEFT 4
  49. #define TL 5
  50. #define COORD 6
  51. #define TRBL 0
  52. #define TLBR 1
  53. #define ROW 2
  54. #define ROWTYPES 3
  55. #define LOW 0
  56. #define HIGH 1
  57. #define SPACES 2
  58.  
  59. /* The following are in xhexagons.c also */
  60. #define MINHEXAGONS 1
  61. #define NOCORN 0
  62. #define CORNERS 1
  63. #define MAXORIENT 2
  64.  
  65. #define DEFAULTCORNERS CORNERS
  66. #define DEFAULTHEXAGONS 3
  67.  
  68. #define ABS(a) (((a)<0)?(-a):(a))
  69. #define SIGN(a) (((a)<0)?(-1):1)
  70. #define MIN(a,b) (((int)(a)<(int)(b))?(int)(a):(int)(b))
  71. #define MAX(a,b) (((int)(a)>(int)(b))?(int)(a):(int)(b))
  72.  
  73. typedef struct _HexagonsPart
  74. {
  75.   Pixel foreground;
  76.   Pixel tileColor, borderColor;
  77.   int *tileOfPosition, spacePosition[SPACES];
  78.   int spaceRow[ROWTYPES];
  79.   int currentPosition, currentRow[ROWTYPES];
  80.   Boolean started, vertical, corners;
  81.   int base;
  82.   int size, sizeSize, sizeCenter;
  83.   XPoint offset, tileSize, puzzleSize;
  84.   XPoint delta, puzzleOffset, digitOffset;
  85.   GC puzzleGC;
  86.   GC tileGC;
  87.   GC borderGC;
  88.   GC inverseGC;
  89.   XtCallbackList select;
  90. } HexagonsPart;
  91.  
  92. typedef struct _HexagonsRec
  93. {
  94.   CorePart core;
  95.   HexagonsPart hexagons;
  96. } HexagonsRec;
  97.  
  98. /* This gets around C's inability to do inheritance */
  99. typedef struct _HexagonsClassPart
  100. {
  101.   int ignore;
  102. } HexagonsClassPart;
  103.  
  104. typedef struct _HexagonsClassRec
  105. {
  106.   CoreClassPart core_class;
  107.   HexagonsClassPart hexagons_class;
  108. } HexagonsClassRec;
  109.  
  110. extern HexagonsClassRec hexagonsClassRec;
  111. extern int *startPosition;
  112.  
  113. extern int MoveHexagonsDir();
  114. /*extern void SolveTiles();*/ /* For future auto-solver */
  115. extern void DrawAllTiles();
  116. extern Boolean CheckSolved();
  117. extern void InitMoves();
  118. extern void PutMove();
  119. extern void GetMove();
  120. extern int MadeMoves();
  121. extern void FlushMoves();
  122. extern int NumMoves();
  123. extern void ScanMoves();
  124. extern void PrintMoves();
  125. extern void ScanStartPosition();
  126. extern void PrintStartPosition();
  127. extern void SetStartPosition();
  128. extern int Row();
  129. extern int TrBl();
  130. extern int TlBr();
  131.  
  132. #endif /* _HexagonsP_h */
  133.